package com.ctg.itrdc.imageconsole.common.constants;

import java.security.AccessController;
import java.security.PrivilegedAction;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Path {

	private static final Logger logger = LoggerFactory.getLogger(Path.class);
	private final static String CLASS_PATH = getContextClassLoader().getResource("").getFile();
	
	public final static String BUILD_PATH = CLASS_PATH + "build/";
	public final static String BUILD_LOG_PATH = CLASS_PATH + "build/buildlogs/";
	public final static String BUILD_FILE_PATH = CLASS_PATH + "build/buildfiles/";

	private static ClassLoader getContextClassLoader() {
		return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {

			@Override
			public ClassLoader run() {
				ClassLoader cl = null;
				try {
					cl = Thread.currentThread().getContextClassLoader();
				} catch (SecurityException ex) {
					logger.warn("Unable to get context classloader instance.", ex);
				}
				return cl;
			}
		});
	}
}
